﻿namespace Agent
{
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Threading;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Markup;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;

    [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
    public class NotificationWindow : UserControl, IComponentConnector
    {
        private EventHandler a;
        private EventHandler b;
        internal Border c;
        internal TextBlock d;
        internal Label e;
        internal Label f;
        private bool g;

        public NotificationWindow()
        {
            this.InitializeComponent();
        }

        public NotificationWindow(AgentMessageEventArgs A_0)
        {
            this.InitializeComponent();
            if (A_0.c() == NotificationType.Error)
            {
                Uri uriSource = new Uri("pack://application:,,,/thesafety;component/Resources/form_error.png", UriKind.RelativeOrAbsolute);
                ImageBrush brush = new ImageBrush {
                    ImageSource = new BitmapImage(uriSource)
                };
                this.c.Background = brush;
            }
            this.d.Text = "";
            this.d.Inlines.Add(new System.Windows.Documents.Run(A_0.d()));
            if (A_0.b() != null)
            {
                this.d(A_0.b());
            }
            if (A_0.e() != null)
            {
                this.b(A_0.e());
            }
        }

        public void a(EventHandler A_0)
        {
            EventHandler handler2;
            EventHandler a = this.a;
            do
            {
                handler2 = a;
                EventHandler handler3 = (EventHandler) Delegate.Remove(handler2, A_0);
                a = Interlocked.CompareExchange<EventHandler>(ref this.a, handler3, handler2);
            }
            while (a != handler2);
        }

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)]
        private void a(int A_0, object A_1)
        {
            switch (A_0)
            {
                case 1:
                    this.c = (Border) A_1;
                    return;

                case 2:
                    this.d = (TextBlock) A_1;
                    return;

                case 3:
                    this.e = (Label) A_1;
                    this.e.MouseLeftButtonUp += new MouseButtonEventHandler(this.lblHide_MouseLeftButtonUp);
                    return;

                case 4:
                    this.f = (Label) A_1;
                    this.f.MouseLeftButtonUp += new MouseButtonEventHandler(this.lblX_MouseLeftButtonUp);
                    return;
            }
            this.g = true;
        }

        public void b(EventHandler A_0)
        {
            EventHandler handler2;
            EventHandler b = this.b;
            do
            {
                handler2 = b;
                EventHandler handler3 = (EventHandler) Delegate.Combine(handler2, A_0);
                b = Interlocked.CompareExchange<EventHandler>(ref this.b, handler3, handler2);
            }
            while (b != handler2);
        }

        public void c(EventHandler A_0)
        {
            EventHandler handler2;
            EventHandler b = this.b;
            do
            {
                handler2 = b;
                EventHandler handler3 = (EventHandler) Delegate.Remove(handler2, A_0);
                b = Interlocked.CompareExchange<EventHandler>(ref this.b, handler3, handler2);
            }
            while (b != handler2);
        }

        public void d(EventHandler A_0)
        {
            EventHandler handler2;
            EventHandler a = this.a;
            do
            {
                handler2 = a;
                EventHandler handler3 = (EventHandler) Delegate.Combine(handler2, A_0);
                a = Interlocked.CompareExchange<EventHandler>(ref this.a, handler3, handler2);
            }
            while (a != handler2);
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this.g)
            {
                this.g = true;
                Uri resourceLocator = new Uri("/TheSafety;component/notificationwindow.xaml", UriKind.Relative);
                Application.LoadComponent(this, resourceLocator);
            }
        }

        private void lblHide_MouseLeftButtonUp(object A_0, MouseButtonEventArgs A_1)
        {
            if (this.b != null)
            {
                this.b(this, null);
            }
            base.Visibility = Visibility.Hidden;
        }

        private void lblX_MouseLeftButtonUp(object A_0, MouseButtonEventArgs A_1)
        {
            if (this.a != null)
            {
                this.a(this, null);
            }
            base.Visibility = Visibility.Hidden;
        }
    }
}

